package com.sqfw.common.enums.knowledge;

import lombok.Getter;

/**
 * 排序类型
 *  KL_SCORE--评分
 *  KL_HITS--点击量
 * */
public enum KlContentSortTypeEnum {

    KL_SCORE("KL_SCORE", "评分"),
    KL_HITS("KL_HITS", "点击量"),
    ;

    @Getter
    private String key;
    @Getter
    private String desc;

    KlContentSortTypeEnum(String key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    /**
     * 根据key，查询描述
     * */
    public static KlContentSortTypeEnum by(String key) {
        KlContentSortTypeEnum[] enums = KlContentSortTypeEnum.values();
        for (int i = 0; i < enums.length; i++) {
            if (key.equals(enums[i].key) ) {
                return enums[i];
            }
        }
        return null;
    }

}
